package com.ruyuan.eshop.common.enums.construction;

import java.util.HashMap;
import java.util.Map;

/**
 * @author zhonghuashishan
 * @version 1.0
 */
public enum AuditTypeEnum {


    /**
     * 建品
     */
    GOODS(1, "建品"),

    /**
     * 价格
     */
    PRICE(2, "价格");

    private Integer code;

    private String value;

    AuditTypeEnum(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public Integer getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }

    public static Map<Integer, String> toMap(){
        Map<Integer, String> map = new HashMap<>(16);
        for (AuditTypeEnum element : AuditTypeEnum.values() ){
            map.put(element.getCode(),element.getValue());
        }
        return map;
    }

    public static AuditTypeEnum getByCode(Integer code){
        if(code == null) {
            return null;
        }
        for(AuditTypeEnum element : AuditTypeEnum.values()){
            if (code.equals(element.getCode())) {
                return element;
            }
        }
        return null;
    }

}
